<template>
	<body-wrap>
		<navigator class="tcInfoItem" v-for="dt in follows" :key="dt" :url="`/pages/tDetail/index?id=${dt.teacher._id}`">
			<view class="imgbox">
				<cm-image  v-if="dt.teacher" :src="dt.teacher.selfAvatar || dt.teacher.avatar"/>
			</view>
			<view class="top-con">
				<view class="name">{{dt.teacher.name || dt.teacher.nickname}}<text class="bzhi">专家</text></view>
				<view class="intro">
					{{dt.teacher.company}} | {{dt.teacher.industry}} | {{dt.teacher.jobs}}
				</view>
			</view>
			<view class="lkicon">
				<i class="iconfont icon-xiangyoujiantou"></i>
			</view>
		</navigator>
	</body-wrap>
</template>

<script>
	import {defineComponent,reactive,toRefs,onMounted,getCurrentInstance,computed} from 'vue'
	import {onLoad,onShow} from '@dcloudio/uni-app'
	import { useStore } from 'vuex'
	import bodyWrap from "@/components/bodyWrap/index.vue"
	import cmImage from "@/components/cmImage/index.vue"
	import {getFollowList} from "@/api/consult.js"
	export default defineComponent({
		components:{
			bodyWrap,
			cmImage
		},
		props:{
		
		},
		setup(props,context) {
			const store = useStore()
			const {proxy} = getCurrentInstance()
			
			const state = reactive({
				userInfo:computed(()=>store.state.base.userInfo),
				follows:''
			})
			
			onMounted(()=>{
				getgzlist()
			})
			
			const getgzlist = ()=>{
				getFollowList({
					user:state.userInfo._id
				}).then(res =>{
					state.follows = res.data.data || []
				})
			}
			
			return {
				...toRefs(state),
			}
		}
	})
</script>

<style lang="scss" scoped>
	.tcInfoItem{
		display: flex;
		padding: 20rpx;
		background: #fff;
		&+.tcInfoItem{
			margin-top: 20rpx;
		}
		.imgbox{
			width: 100rpx;
			height: 100rpx;
			border-radius: 50%;
			overflow: hidden;
			flex-shrink: 0;
		}
		.top-con{
			padding: 0 0 0 20rpx;
			flex-shrink: 0;
			height: 0;
			flex: 1;
			.name{
				display: flex;
				height: 50rpx;
				align-items: center;
				font-size: 30rpx;
				font-weight: bold;
				padding: 0;
				margin: 0;
				.bzhi{
					background-color: #ff1120;
					font-size: 26rpx;
					color: #fff;
					padding: 0 8rpx;
					border-radius: 5rpx;
					margin: 0 0 0 10rpx;
				}
			}
			.intro{
				color: #999;
				font-size: 28rpx;
				height: 50rpx;
				line-height: 50rpx;
				width: 100%;
				white-space: nowrap;
				text-overflow: ellipsis;
				overflow: hidden;
				word-break: break-all;
			}
		}
		.lkicon{
			display: flex;
			align-items: center;
		}
		
	}
</style>
